Main Colors
plot_pal(omics_colors(1:8))Small utility function to visualize color palettes and a desatured
version of the same palette with the help of the
{prismatic} package.
plot_pal <- function(pal) {
plot(prismatic::color(pal))
plot(prismatic::color(colorspace::desaturate(pal, 1)))
}Retrieve single colors or a set of colors with
omics_colors().
omics_colors("brand_blue")## brand_blue
## "#3181de"
omics_colors(c("brand_blue", "red", "mid_grey"))## brand_blue red mid_grey
## "#3181de" "#f23451" "#d8d8d8"
omics_colors()[1:4]## brand_blue dark_orange turquoise terra_cotta
## "#3181de" "#BC7408" "#009c9f" "#bf616a"
omics_colors()[1:14]## brand_blue dark_orange turquoise terra_cotta purple
## "#3181de" "#BC7408" "#009c9f" "#bf616a" "#A06EC5"
## green pastel_blue dark_grey red orange
## "#5B9B5B" "#81a1c1" "#989898" "#f23451" "#e3a45a"
## bright_blue super_dark_grey mid_grey grey
## "#2fb5e3" "#3b4252" "#d8d8d8" "#eeeeee"
plot_pal(omics_colors(1:14))plot_pal(omics_colors(1:8))plot_pal(omics_colors(c(9:11)))plot_pal(omics_colors(c(8, 12:14)))Single-hue sequential color palettes map a number of light to dark shades of the same color family to numeric values. Such color palettes are sued in case the main attention is on one end of the value range. The colors with the highest visual weight should be mapped to the values of interest.
Create sequential color palettes with omics_pal_c(). By
default, the colors with the highest contrast are mapped to the highest
values (optimal for most use cases).
brand_blueBS Color “Bleu De France” (primary)
plot_pal(omics_pal_c()(7))dark_orangeplot_pal(omics_pal_c(palette = "dark_orange")(7))turquoiseBS Color “Viridian Green” (success)
plot_pal(omics_pal_c(palette = "turquoise")(7))terra_cottaBS Color “Dark Terra Cotta” (warning)
plot_pal(omics_pal_c(palette = "terra_cotta")(7))purpleplot_pal(omics_pal_c(palette = "purple")(7))greenplot_pal(omics_pal_c(palette = "green")(7))pastel_blueBS Color “Dark Pastel Blue” (secondary)
plot_pal(omics_pal_c(palette = "pastel_blue")(7))greyplot_pal(omics_pal_c(palette = "grey")(7))redplot_pal(omics_pal_c(palette = "red")(7))bright_blueplot_pal(omics_pal_c(palette = "bright_blue")(7))orangeplot_pal(omics_pal_c(palette = "orange")(7))Diverging palettes are a gradient consisting of two hues that are blended towards the center values (midpoint). The palettes are designed in a way that colors usually associated with “bad” or “lows” such as red and orange are pointing towards the minimal values. Keep in mind that the midpoint should be picked with care and be meaningful to the reader (i.e. why are values below the midpoint different from those above the threshold?).
Create diverging color palettes with omics_pal_c(). By
default, the alarming colors such as red, orange, and yellow
are mapped to the lower, most often negative.
In general, there are two types of diverging palettes: those that blend two main colors and a version with grey as midpoint color.
brand_blueplot_pal(omics_pal_c(palette = "blue_red")(7))blue_orangeplot_pal(omics_pal_c(palette = "blue_orange")(7))pastel_blue_orangeplot_pal(omics_pal_c(palette = "pastel_blue_orange")(7))turq_orangeplot_pal(omics_pal_c(palette = "turq_orange")(7))blue_red_greyplot_pal(omics_pal_c(palette = "blue_red_grey")(7))blue_orange_greyplot_pal(omics_pal_c(palette = "blue_orange_grey")(7))pastel_blue_orange_greyplot_pal(omics_pal_c(palette = "pastel_blue_orange_grey")(7))turq_orange_greyplot_pal(omics_pal_c(palette = "turq_orange_grey")(7))Categorical color palettes are used for qualitative data and should feature a number of distinct colors of similar visual weight. For most use cases, categorical colors should be limited to 4-6 and never exceed 8 categories.
Create categorical color palettes with omics_pal_d().
All categorical color palettes are for now variants of the same color
palette called default. The categorical palette is limited
to a eight unique colors, with the first being the brand blue. However,
given the limited number of available colors palettes with more than
four colors do not ensure similar visual weights.
defaultplot_pal(omics_pal_d()(8))darkplot_pal(omics_pal_d(palette = "dark")(8))super_darkplot_pal(omics_pal_d(palette = "super_dark")(8))lightplot_pal(omics_pal_d(palette = "light")(8))super_lightplot_pal(omics_pal_d(palette = "super_light")(8))mutedplot_pal(omics_pal_d(palette = "muted")(8))muted_lightplot_pal(omics_pal_d(palette = "muted_light")(8))expanded(only to be used in extreme cases as it resamples the same categorical colors in different shades and allows to color many more categories than recommended)
plot_pal(omics_pal_d(palette = "expanded")(32))highlight_blueplot_pal(omics_pal_d(palette = "highlight_blue")(6))highlight_redplot_pal(omics_pal_d(palette = "highlight_red")(6))highlight_orangeplot_pal(omics_pal_d(palette = "highlight_orange")(6))plot_pal(omics_pal_c(reverse = TRUE)(7))plot_pal(omics_pal_c(palette = "blue_red_grey", reverse = TRUE)(7))plot_pal(omics_pal_d(reverse = TRUE)(4))plot_pal(omics_pal_d(palette = "highlight_blue")(5)[c(1, 3, 5)])## [1] "2023-02-03 19:32:40 CET"
## R version 4.1.0 (2021-05-18)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 22621)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
## [3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
## [5] LC_TIME=German_Germany.1252
## system code page: 65001
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## loaded via a namespace (and not attached):
## [1] rstudioapi_0.14 knitr_1.39 magrittr_2.0.3 munsell_0.5.0
## [5] colorspace_2.0-3 here_1.0.1 R6_2.5.1 ragg_1.2.2
## [9] rlang_1.0.4 fastmap_1.1.0 highr_0.9 stringr_1.4.1
## [13] tools_4.1.0 xfun_0.31 cli_3.3.0 jquerylib_0.1.4
## [17] htmltools_0.5.2 systemfonts_1.0.3 yaml_2.2.1 digest_0.6.29
## [21] rprojroot_2.0.3 lifecycle_1.0.1 textshaping_0.3.6 farver_2.1.0
## [25] sass_0.4.2 cachem_1.0.6 evaluate_0.16 rmarkdown_2.16
## [29] stringi_1.7.5 compiler_4.1.0 bslib_0.4.0 scales_1.2.1
## [33] prismatic_1.1.1 jsonlite_1.7.2